/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Model;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
 *
 * @author cpn02
 */
public class Connector {
    private String dbName;
    private Connection cnn =null;
    public Connector()
    {
        this.dbName = "BabyShop";
    }
    public Connector(String dbName) 
    {
        this.dbName = dbName;
        
    }
    public Connection connect()throws ClassNotFoundException, SQLException
    {
        Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
        cnn = java.sql.DriverManager.getConnection("jdbc:odbc:"+dbName);
        return cnn;
    }
    public void closeDB()
    {
        try {
            cnn.close();
        } catch (SQLException ex) {
            ex.printStackTrace();
        }
    }
}
